/*
 * @Author: 18059301505 275895816@qq.com
 * @Date: 2022-11-07 15:48:40
 * @LastEditors: 18059301505 275895816@qq.com
 * @LastEditTime: 2022-11-29 12:02:16
 * @FilePath: \bosssoft-train-user-permission-centre-front-end\src\api\right\role.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import request from '@/utils/request'
// eslint-disable-next-line quotes
const ROLE_URL = '/v1/role'
// 获取资源
export function getResource(RoleQuery) {
  return request({
    url: ROLE_URL,
    method: 'get',
    params: RoleQuery
  })
}
// 添加
export function add(RoleDTO) {
  return request({
    url: ROLE_URL,
    method: 'post',
    data: RoleDTO
  })
}
// 删除
export function remove(id, version) {
  return request({
    url: ROLE_URL,
    method: 'delete',
    params: { id: id, version: version }
  })
}
// 批量删除
export function batchRemove(RoleDTOs) {
  return request({
    url: ROLE_URL + '/batch',
    method: 'delete',
    data: RoleDTOs
  })
}
// 根据用户id查询(编辑更新功能展示)
export function queryRoleById(id) {
  return request({
    url: ROLE_URL + '/' + id,
    method: 'get'
  })
}
// 修改用户
export function modify(roleInfos) {
  return request({
    url: ROLE_URL,
    method: 'put',
    data: roleInfos
  })
}
// 分配资源
export function assignResource(roleResourceDTO) {
  return request({
    url: ROLE_URL + '/assignResource',
    method: 'post',
    data: roleResourceDTO
  })
}
// 获取用户资源
export function commonQuery(RoleQuery) {
  return request({
    url: ROLE_URL,
    method: 'get',
    params: RoleQuery
  })
}

export function commonQueryUser(userQuery) {
  return request({
    url: ROLE_URL + '/commonQueryUser',
    method: 'get',
    params: userQuery
  })
}

export function assignUser(userRoleDTO) {
  return request({
    url: ROLE_URL + '/assignUser',
    method: 'post',
    data: userRoleDTO
  })
}
